package task.www.lagou.entity;

import java.sql.Date;
import java.util.Objects;

public class Phone {
    private int id;
    private String pname;
    private double price;
    private Date prodate;
    private String color;

    public Phone() {
    }

    public Phone(int id, String pname, double price, Date prodate, String color) {
        this.id = id;
        this.pname = pname;
        this.price = price;
        this.prodate = prodate;
        this.color = color;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPname() {
        return pname;
    }

    public void setPname(String pname) {
        this.pname = pname;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public Date getProdate() {
        return prodate;
    }

    public void setProdate(Date prodate) {
        this.prodate = prodate;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Phone phone = (Phone) o;
        return id == phone.id &&
                Double.compare(phone.price, price) == 0 &&
                pname.equals(phone.pname) &&
                prodate.equals(phone.prodate) &&
                color.equals(phone.color);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, pname, price, prodate, color);
    }

    @Override
    public String toString() {
        return "phone{" +
                "id=" + id +
                ", pname='" + pname + '\'' +
                ", price=" + price +
                ", prodate=" + prodate +
                ", color='" + color + '\'' +
                '}';
    }
}
